﻿@using PayrollExpress.Helpers;
@using PayrollExpress.Models;
@model HolidayEditModel

@Html.Partial("_BreadCrumb", Model.BreadCrumb)

@using (Html.BeginForm(BaseHelper.PageAddEditSave.HolidaySave.ToString(), Model.ControllerName, FormMethod.Post, new { id = "saveForm" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>

        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-8">
                    <div class="ibox float-e-margins">

                        <div class="ibox-title">
                            <div>@Html.ValidationMessageFor(m => m.Type.Month)</div>
                            <div>@Html.ValidationMessageFor(m => m.Type.Day)</div>
                            <div>@Html.ValidationMessageFor(m => m.Type.Year)</div>
                            <div>@Html.ValidationMessageFor(m => m.Type.Description)</div>
                            <div>@Html.ValidationMessageFor(m => m.Type.HolidayTypeID)</div>
                        </div>

                        <div class="ibox-content">
                            <table class="table table-bordered table-striped table-hover">
                                <tr>
                                    <th>@Html.LabelFor(m => m.Type.Month)</th>
                                    <td>
                                        @Html.DropDownListFor(m => m.Type.Month, Model.CalendarMonths, new { @class = "form-control input" })
                                    </td>
                                </tr>
                                <tr>
                                    <th>@Html.LabelFor(m => m.Type.Day)</th>
                                    <td>
                                        @Html.DropDownListFor(m => m.Type.Day, Model.CalendarDays, new { @class = "form-control input" })
                                    </td>
                                </tr>
                                <tr>
                                    <th>@Html.LabelFor(m => m.Type.Year)</th>
                                    <td>
                                        <span class="single-line">@Html.DisplayFor(m => m.Type.Year)</span>
                                        @Html.HiddenFor(m => m.Type.Year)
                                    </td>
                                </tr>
                                <tr>
                                    <th>@Html.LabelFor(m => m.Type.Description)</th>
                                    <td>
                                        @Html.HiddenFor(m => m.Type.ID)
                                        @Html.HiddenFor(m => m.Type.RecurringHolidayID)
                                        @Html.EditorFor(m => m.Type.Description)
                                    </td>
                                </tr>
                                <tr>
                                    <th>@Html.LabelFor(m => m.Type.HolidayTypeID)</th>
                                    <td>
                                        @Html.DropDownListFor(m => m.Type.HolidayTypeID, Model.HolidayTypes, new { @class = "form-control input" })
                                    </td>
                                </tr>
                            </table>
                            <p></p>
                            <button type="submit" id="btnSave" class="btn btn-primary" name="command" value=@Model.PageAction>@BaseHelper.PageAction.Save.ToDescription()</button>
                            <button type="submit" id="btnCancel" class="btn btn-primary cancel" name="command" value="@BaseHelper.PageAction.Cancel.ToString()">@BaseHelper.PageAction.Cancel.ToDescription()</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </fieldset>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")

    <script type="text/javascript">

        $(document).ready(function () {
            $(window).keydown(function (event) {
                if (event.keyCode == 13) {
                    event.preventDefault();
                    return false;
                }
            });
        });

    </script>
}